export interface IApiError {
    errcode: number
    errmsg: string
}

export class ApiError extends Error {
    constructor(errcode: number, errmsg: string)
    constructor(err: IApiError)
    constructor(arg1: number | IApiError, errmsg?: string) {
        if (typeof arg1 === 'number') {
            super(`[${arg1}] ${errmsg}`)
        } else {
            super(`[${arg1.errcode}] ${arg1.errmsg}`)
        }
    }
}
